package thinkingJava.chapter05;

import static util.Print.*;
class Bow1 {
	Bow1(int marker) {
		print("Bow1(" + marker + ")");
	}
	void f1(int marker) {
		print("f1(" + marker + ")");
	}
}
class Table {
	static Bow1 bow1 = new Bow1(1);
	Table() {
		print("Table()");
		bow2.f1(1);
	}
	void f2(int marker) {
		print("f2(" + marker + ")");
	}
	static Bow1 bow2 = new Bow1(2);
}
class CupBoard {
	Bow1 bow3 = new Bow1(3);
	static Bow1 bow4 = new Bow1(4);
	CupBoard() {
		print("CupBoard()");
		bow4.f1(2);
	}
	void f3(int marker) {
		print("f3(" + marker + ")");
	}
	static Bow1 bow5 = new Bow1(5);

}

public class StaticInitialization {
	public static void main(String[] args) {
		print("creating new CupBoard in main");
		new CupBoard();
		print("creating new CupBoard in main");
		new CupBoard();
		table.f2(1);
		cup.f3(1);
	}
	static CupBoard cup = new CupBoard();
	static Table table = new Table();
}
